700 |
How can I filter the check-boxes (method 1)
with AxGrid1 do begin with (Columns.Add('Check') as EXGRIDLib.Column) do begin with Editor do begin EditType := EXGRIDLib.EditTypeEnum.CheckValueType; Option[EXGRIDLib.EditorOptionEnum.exCheckValue2] := TObject(1); end; DisplayFilterButton := True; DisplayFilterPattern := False; FilterType := EXGRIDLib.FilterTypeEnum.exCheck; end; with Items do begin AddItem(TObject(True)); AddItem(TObject(True)); AddItem(TObject(False)); AddItem(TObject(True)); AddItem(TObject(False)); AddItem(TObject(True)); AddItem(TObject(False)); end; end |
699 |
How can add a button to control
// ButtonClick event - Occurs when user clicks on the cell's button. procedure TWinForm1.AxGrid1_ButtonClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ButtonClickEvent); begin with AxGrid1 do begin OutputDebugString( 'ButtonClick' ); OutputDebugString( Items.CellCaption[TObject(e.item),TObject(e.colIndex)] ); OutputDebugString( e.key ); end end; with AxGrid1 do begin BeginUpdate(); DefaultItemHeight := 22; HeaderHeight := 22; Appearance := EXGRIDLib.AppearanceEnum.None2; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; ScrollBySingleLine := False; Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' + 'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' + 'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' + 'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA='); set_HTMLPicture('pic1','c:\exontrol\images\auction.gif'); with Columns do begin with (Add('Type') as EXGRIDLib.Column) do begin Width := 48; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; with (Add('Appearance') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment; HeaderAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment; end; end; with Items do begin h := AddItem('Items.<b>CellHasButton</b> property'); CellValue[TObject(h),TObject(1)] := 'Button <b>1</b>'; CellHasButton[TObject(h),TObject(1)] := True; h := AddItem('Items.<b>CellButtonAutoWidth</b> property'); CellValue[TObject(h),TObject(1)] := ' Button <b>2</b> '; CellHasButton[TObject(h),TObject(1)] := True; CellButtonAutoWidth[TObject(h),TObject(1)] := True; h := AddItem('Items.<b>CellHasButton</b> property'); CellValue[TObject(h),TObject(1)] := ' <img>2</img>Button <b>3</b> '; CellHasButton[TObject(h),TObject(1)] := True; CellButtonAutoWidth[TObject(h),TObject(1)] := True; h := AddItem('Items.<b>CellHasButton</b> property'); ItemHeight[h] := 32; CellValue[TObject(h),TObject(1)] := ' <img>2</img>Button <b>4</b> <img>pic1</img> '; CellHasButton[TObject(h),TObject(1)] := True; CellButtonAutoWidth[TObject(h),TObject(1)] := True; h := AddItem('Items.<b>CellHasButton</b> in splitted cells'); CellValue[TObject(h),TObject(1)] := ' Button <b>5.1</b> '; CellHasButton[TObject(h),TObject(1)] := True; CellButtonAutoWidth[TObject(h),TObject(1)] := True; s := SplitCell[TObject(h),TObject(1)]; CellValue[TObject(0),TObject(s)] := ' Button <b>5.2</b> '; CellHasButton[TObject(0),TObject(s)] := True; CellButtonAutoWidth[TObject(0),TObject(s)] := True; h := AddItem('Column.<b>Editor</b>, Items.<b>CellEditor</b>'); CellValue[TObject(h),TObject(1)] := 'Visible when clicking the cell'; with CellEditor[TObject(h),TObject(1)] do begin EditType := EXGRIDLib.EditTypeEnum.EditType; AddButton('B1',TObject(1),TObject(0),'This is a bit of text that''s shown when the cursor hovers the button B1',Nil,Nil); AddButton('B3',TObject(2),TObject(1),'This is a bit of text that''s shown when the cursor hovers the button B3',Nil,Nil); AddButton('B4',TObject(1),TObject(1),'This is a bit of text that''s shown when the cursor hovers the button B4',Nil,Nil); ButtonWidth := 24; end; h := AddItem('Column.<b>Editor</b>, Items.<b>CellEditor</b>'); CellValue[TObject(h),TObject(1)] := TObject(3); with CellEditor[TObject(h),TObject(1)] do begin EditType := EXGRIDLib.EditTypeEnum.CheckListType; AddItem(1,'Flag 1',Nil); AddItem(2,'Flag 2',Nil); AddItem(4,'Flag 4',Nil); AddItem(8,'Flag 8',Nil); AddButton('C1',TObject(1),TObject(0),'This is a bit of text that''s shown when the cursor hovers the button C1',Nil,Nil); AddButton('C3',TObject(2),TObject(0),'This is a bit of text that''s shown when the cursor hovers the button C2',Nil,Nil); AddButton('C4',TObject(1),TObject(0),'This is a bit of text that''s shown when the cursor hovers the button C3',Nil,Nil); ButtonWidth := 24; end; end; EndUpdate(); end |
698 |
The item is not getting selected when clicking the cell's checkbox. What should I do
// CellStateChanged event - Fired after cell's state has been changed. procedure TWinForm1.AxGrid1_CellStateChanged(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellStateChangedEvent); begin with AxGrid1 do begin Items.SelectItem[e.item] := True; end end; with AxGrid1 do begin (Columns.Add('Check') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True); with Items do begin AddItem(TObject(0)); AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); end; end |
697 |
Is it possible to limit the height of the item while resizing
// AddItem event - Occurs after a new Item has been inserted to Items collection. procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent); begin with AxGrid1 do begin Items.ItemMinHeight[e.item] := 18; Items.ItemMaxHeight[e.item] := 72; end end; with AxGrid1 do begin BeginUpdate(); ItemsAllowSizing := EXGRIDLib.ItemsAllowSizingEnum.exResizeItem; ScrollBySingleLine := False; BackColorAlternate := Color.FromArgb(240,240,240); Columns.Add('Names'); with Items do begin AddItem('Mantel'); AddItem('Mechanik'); AddItem('Motor'); AddItem('Murks'); AddItem('Märchen'); AddItem('Möhren'); AddItem('Mühle'); end; Columns.Item[TObject(0)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending; EndUpdate(); end |
696 |
Is it possible to copy the hierarchy of the control using the GetItems method
with AxGrid1 do begin LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Def'); with Items do begin h := AddItem('Root'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); end; PutItems(GetItems(TObject(-1)),Nil); end |
695 |
Is it possible to auto-numbering the children items but still keeps the position after filtering
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; with (Columns.Add('Items') as EXGRIDLib.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib.FilterTypeEnum.exFilter; Filter := 'Child 2'; end; with (Columns.Add('Pos.1') as EXGRIDLib.Column) do begin FormatColumn := '1 ropos '''''; Position := 0; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.2') as EXGRIDLib.Column) do begin FormatColumn := '1 ropos '':'''; Position := 1; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.3') as EXGRIDLib.Column) do begin FormatColumn := '1 ropos '':|A-Z'''; Position := 2; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.4') as EXGRIDLib.Column) do begin FormatColumn := '1 ropos ''|A-Z|'''; Position := 3; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.5') as EXGRIDLib.Column) do begin FormatColumn := '''<font Tahoma;7>'' + 1 ropos ''-<b>||A-Z'''; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); Position := 4; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.6') as EXGRIDLib.Column) do begin FormatColumn := '''<b>''+ 1 ropos ''</b>:<fgcolor=FF0000>|A-Z|'''; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); Position := 5; Width := 48; AllowSizing := False; end; with Items do begin h := AddItem('Root 1'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); end; ApplyFilter(); EndUpdate(); end |
694 |
Is it possible to auto-numbering the children items too
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with (Columns.Add('Pos.1') as EXGRIDLib.Column) do begin FormatColumn := '1 rpos '''''; Position := 0; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.2') as EXGRIDLib.Column) do begin FormatColumn := '1 rpos '':'''; Position := 1; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.3') as EXGRIDLib.Column) do begin FormatColumn := '1 rpos '':|A-Z'''; Position := 2; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.4') as EXGRIDLib.Column) do begin FormatColumn := '1 rpos ''|A-Z|'''; Position := 3; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.5') as EXGRIDLib.Column) do begin FormatColumn := '''<font Tahoma;7>'' + 1 rpos ''-<b>||A-Z'''; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); Position := 4; Width := 32; AllowSizing := False; end; with (Columns.Add('Pos.6') as EXGRIDLib.Column) do begin FormatColumn := '''<b>''+ 1 rpos ''</b>:<fgcolor=FF0000>|A-Z|'''; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); Position := 5; Width := 48; AllowSizing := False; end; with Items do begin h := AddItem('Root 1'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); end; EndUpdate(); end |
693 |
Is it possible to cancel or discard the values during validation
// ValidateValue event - Occurs before user changes the cell's value. procedure TWinForm1.AxGrid1_ValidateValue(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ValidateValueEvent); begin with AxGrid1 do begin OutputDebugString( 'ValidateValue' ); OutputDebugString( e.newValue ); OutputDebugString( 'Change the Cancel parameter for ValidateValue event to accept/decline the newly value. ' ); OutputDebugString( 'The DiscardValidateValue restores back the previously values.' ); DiscardValidateValue(); end end; with AxGrid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib.ValidateValueType.exValidateCell; (Columns.Add('Date') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.DateType; (Columns.Add('Text') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; end; EndUpdate(); end |
692 |
Is it possible to validate the values of the cells only when user leaves the focused item
// ValidateValue event - Occurs before user changes the cell's value. procedure TWinForm1.AxGrid1_ValidateValue(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ValidateValueEvent); begin with AxGrid1 do begin OutputDebugString( 'ValidateValue' ); OutputDebugString( e.newValue ); OutputDebugString( 'Change the Cancel parameter for ValidateValue event to accept/decline the newly value. ' ); e.cancel := True; OutputDebugString( 'You can not leave the item/record until the Cancel is False.' ); end end; with AxGrid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib.ValidateValueType.exValidateItem; (Columns.Add('Date') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.DateType; (Columns.Add('Text') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; end; EndUpdate(); end |
691 |
We would like to validate the values of the cells. Is it possible
// ValidateValue event - Occurs before user changes the cell's value. procedure TWinForm1.AxGrid1_ValidateValue(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ValidateValueEvent); begin with AxGrid1 do begin OutputDebugString( 'ValidateValue' ); OutputDebugString( e.newValue ); OutputDebugString( 'Change the Cancel parameter for ValidateValue event to accept/decline the newly value.' ); e.cancel := True; OutputDebugString( 'You can not leave the cell until the Cancel is False.' ); end end; with AxGrid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib.ValidateValueType.exValidateCell; (Columns.Add('Date') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.DateType; (Columns.Add('Text') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; CellValue[TObject(AddItem('1/1/2001')),TObject(1)] := 'text'; end; EndUpdate(); end |
690 |
Is there any way to add auto-numbering
with AxGrid1 do begin with Columns do begin Add('Items'); with (Add('Pos') as EXGRIDLib.Column) do begin FormatColumn := '1 pos '''''; Position := 0; end; end; with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; end |
689 |
Does your control supports multiple lines tooltip
|
688 |
How can I prevent highlighting the column from the cursor - point
with AxGrid1 do begin VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAEGg4BI0IQAAYAQGKIYBkAKBQAGaAoDDUOQzQwAAxDKKUEwsACEIrjKCYVgOHYYRrIMYgBCMJhLEoaZLhEZRQiqDYtRDFQBSDDcPw/EaRZohGaYJg' + 'EgI='); set_Background(EXGRIDLib.BackgroundPartEnum.exCursorHoverColumn,$1000000); (Columns.Add('S') as EXGRIDLib.Column).Width := 32; (Columns.Add('Level 1') as EXGRIDLib.Column).LevelKey := TObject(1); (Columns.Add('Level 2') as EXGRIDLib.Column).LevelKey := TObject(1); (Columns.Add('Level 3') as EXGRIDLib.Column).LevelKey := TObject(1); (Columns.Add('E1') as EXGRIDLib.Column).Width := 32; (Columns.Add('E2') as EXGRIDLib.Column).Width := 32; (Columns.Add('E3') as EXGRIDLib.Column).Width := 32; (Columns.Add('E4') as EXGRIDLib.Column).Width := 32; end |
687 |
Is it possible display numbers in the same format no matter of regional settings in the control panel
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default positive)'''; h := AddItem(TObject(100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''2|.|3|,|1|1'')'; h := AddItem(TObject(-100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default negative)'''; h := AddItem(TObject(-100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''2|.|3|,|1|1'')'; end; EndUpdate(); end |
686 |
Is it possible to add a 0 for numbers less than 1 instead .7 to show 0.8
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(0.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(TObject(0.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''|||||0'') + '' <fgcolor=808080>(Display no leading zeros)'''; end; EndUpdate(); end |
685 |
How can I specify the format for negative numbers
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(-100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(TObject(-100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''||||1'') + '' <fgcolor=808080>(Negative sign, number; for example, -1.1)'''; end; EndUpdate(); end |
684 |
Is it possible to change the grouping character when display numbers
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(TObject(100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''|||-'') + '' <fgcolor=808080>(grouping character is -)'''; end; EndUpdate(); end |
683 |
How can I display numbers with 2 digits in each group
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(TObject(100000.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''||2'') + '' <fgcolor=808080>(grouping by 2 digits)'''; end; EndUpdate(); end |
682 |
How can I display my numbers using a different decimal separator
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(100.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(TObject(100.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''|;'') + '' <fgcolor=808080>(decimal separator is <b>;</b>)'''; end; EndUpdate(); end |
681 |
Is it possible to display the numbers using 3 (three) digits
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Def') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(100.27)); FormatCell[TObject(h),TObject(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(TObject(100.27)); FormatCell[TObject(h),TObject(0)] := '(value format ''3'') + '' <fgcolor=808080>(3 digits)'''; h := AddItem(TObject(100.27)); FormatCell[TObject(h),TObject(0)] := '(value format 2) + '' <fgcolor=808080>(2 digits)'''; h := AddItem(TObject(100.27)); FormatCell[TObject(h),TObject(0)] := '(value format 1) + '' <fgcolor=808080>(1 digit)'''; end; EndUpdate(); end |
680 |
Is there any option to show the tooltip programmatically
// MouseMove event - Occurs when the user moves the mouse. procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent); begin with AxGrid1 do begin ShowToolTip(get_ItemFromPoint(-1,-1,c,hit),'','8','8',Nil); end end; with AxGrid1 do begin BeginUpdate(); Columns.Add('Def'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; EndUpdate(); end |
679 |
How can I specify the column's width to be the same for all columns
with AxGrid1 do begin with Columns do begin Add('A'); Add('B'); Add('C'); end; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; ColumnAutoResize := True; end |
678 |
How can I set the column's width to my desired width
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin (Add('A') as EXGRIDLib.Column).Width := 128; (Add('B') as EXGRIDLib.Column).Width := 128; end; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; end |
677 |
Is it possible to format numbers
with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (Add('A') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('B') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('C') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' ='''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('A+B+C') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; Width := 64; ComputedField := 'dbl(%1)+dbl(%2)+dbl(%3)'; FormatColumn := 'type(value) in (0,1) ? ''null'' : ( dbl(value)<0 ? ''<fgcolor=FF0000>''+ (value format ''2|.|3|,|1'' ) : (dbl(value)>0 ? ''<fgcolor=000' + '0FF>+''+(value format ''2|.|3|,'' ): ''0.00'') )'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; end; with Items do begin h := AddItem('Root'); CellValueFormat[TObject(h),TObject(4)] := EXGRIDLib.ValueFormatEnum.exComputedField; h1 := InsertItem(h,Nil,'Child 1'); CellValue[TObject(h1),TObject(1)] := TObject(7); CellValue[TObject(h1),TObject(2)] := TObject(3); CellValue[TObject(h1),TObject(3)] := TObject(1); h1 := InsertItem(h,Nil,'Child 2'); CellValue[TObject(h1),TObject(1)] := TObject(-2); CellValue[TObject(h1),TObject(2)] := TObject(-2); CellValue[TObject(h1),TObject(3)] := TObject(-4); h1 := InsertItem(h,Nil,'Child 3'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(2); CellValue[TObject(h1),TObject(3)] := TObject(-4); ExpandItem[h] := True; end; EndUpdate(); end |
676 |
How can I collapse all items
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('Root 1'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); h := AddItem('Root 2'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[0] := False; end; EndUpdate(); end |
675 |
How can I expand all items
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('Root 1'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); h := AddItem('Root 2'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[0] := True; end; EndUpdate(); end |
674 |
Can I display a total field without having to add a child item
with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Numbers') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.SpinType; Numeric := EXGRIDLib.NumericEnum.exFloat; end; end; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); LockedItemCount[EXGRIDLib.VAlignmentEnum.exBottom] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exBottom,0]; CellValue[TObject(h),TObject(0)] := 'sum(all,dir,dbl(%0))'; SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''SUM: ''+value'; end; EndUpdate(); end |
673 |
Can I display the number of child items
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesAtRoot; Columns.Add(''); with Items do begin h := AddItem('Root 1'); hx := SplitCell[TObject(h),TObject(0)]; CellValue[TObject(0),TObject(hx)] := 'count(current,dir,1)'; CellValueFormat[TObject(0),TObject(hx)] := EXGRIDLib.ValueFormatEnum.exTotalField; FormatCell[TObject(0),TObject(hx)] := '''Childs: '' + value'; InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); hx := SplitCell[TObject(h),TObject(0)]; CellValue[TObject(0),TObject(hx)] := 'count(current,dir,1)'; CellValueFormat[TObject(0),TObject(hx)] := EXGRIDLib.ValueFormatEnum.exTotalField; FormatCell[TObject(0),TObject(hx)] := '''Childs: '' + value'; InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); InsertItem(h,Nil,'Child 3'); InsertItem(h,Nil,'Child 4'); end; EndUpdate(); end |
672 |
My field does not display the correctly computed value if I enter data using the control's editors ( concatenation of strings ). What am I doing wrong
with AxGrid1 do begin BeginUpdate(); Columns.Add('T'); with (Columns.Add('A') as EXGRIDLib.Column).Editor do begin Numeric := EXGRIDLib.NumericEnum.exInteger; EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Columns.Add('B') as EXGRIDLib.Column).Editor do begin Numeric := EXGRIDLib.NumericEnum.exInteger; EditType := EXGRIDLib.EditTypeEnum.SpinType; end; Columns.Add('A+B'); with Items do begin h := AddItem('Incorrect'); CellToolTip[TObject(h),TObject(0)] := 'Just type a number in the column A or B. The result will be concaternated'; CellValue[TObject(h),TObject(1)] := '10'; CellValue[TObject(h),TObject(2)] := '20'; CellValue[TObject(h),TObject(3)] := 'currency(%1+%2)'; CellValueFormat[TObject(h),TObject(3)] := EXGRIDLib.ValueFormatEnum.exComputedField; h := AddItem('Correct'); CellValue[TObject(h),TObject(1)] := TObject(10); CellValue[TObject(h),TObject(2)] := TObject(20); CellValue[TObject(h),TObject(3)] := 'currency(dbl(%1)+dbl(%2))'; CellValueFormat[TObject(h),TObject(3)] := EXGRIDLib.ValueFormatEnum.exComputedField; end; EndUpdate(); end |
671 |
The CellValue/CellCaption property gets the result of a computed/total field with text formatting. Is it possible to get that value without text formatting
with AxGrid1 do begin BeginUpdate(); (Columns.Add('A') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; (Columns.Add('B') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; Columns.Add('A+B'); with Items do begin h := AddItem(TObject(10)); CellValue[TObject(h),TObject(1)] := TObject(20); CellValueFormat[TObject(h),TObject(2)] := EXGRIDLib.ValueFormatEnum.exComputedField; CellValue[TObject(h),TObject(2)] := 'currency(dbl(%0)+dbl(%1))'; OutputDebugString( 'CellCaption returns ' ); OutputDebugString( CellCaption[TObject(h),TObject(2)] ); OutputDebugString( 'CellValue returns ' ); OutputDebugString( CellValue[TObject(h),TObject(2)] ); OutputDebugString( 'ComputeValue returns ' ); OutputDebugString( ComputeValue['dbl(%0)+dbl(%1)',TObject(h),TObject(0),TObject(CellValueFormat[TObject(h),TObject(2)])] ); end; EndUpdate(); end |
670 |
Can I get the result of a specified formula as your control does using the ComputedField property
with AxGrid1 do begin BeginUpdate(); Columns.Add('A'); Columns.Add('B'); with Items do begin h := AddItem(TObject(10)); CellValue[TObject(h),TObject(1)] := TObject(20); OutputDebugString( 'A+B is ' ); OutputDebugString( ComputeValue['dbl(%0)+dbl(%1)',TObject(h),TObject(0),TObject(2)] ); end; EndUpdate(); end |
669 |
Is it possible to get the text without HTML formatting
with AxGrid1 do begin BeginUpdate(); Columns.Add(''); with Items do begin h := AddItem('<b>bold</b>'); OutputDebugString( ComputeValue[CellValue[TObject(h),TObject(0)],TObject(h),TObject(0),TObject(1)] ); end; EndUpdate(); end |
668 |
Can I specify an item to be a separator
with AxGrid1 do begin BeginUpdate(); TreeColumnIndex := -1; SortOnClick := EXGRIDLib.SortOnClickEnum.exNoSort; Columns.Add('Numbers'); with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); h := AddItem('separator'); SelectableItem[h] := False; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; ItemDividerLine[h] := EXGRIDLib.DividerLineEnum.ThinLine; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment; AddItem(TObject(3)); AddItem(TObject(4)); end; EndUpdate(); end |
667 |
How can I count only non-zero values
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(0)); AddItem(TObject(0)); AddItem(TObject(0)); AddItem(TObject(0)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('sum(all,dir,dbl(%0)?1:0)'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''COUNT non-zero: ''+value'; end; EndUpdate(); end |
666 |
How can I add a AVG ( average ) field
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('avg(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''AVG: ''+value'; end; EndUpdate(); end |
665 |
How can I add a COUNT field
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('count(all,dir,0)'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''COUNT: ''+value'; end; EndUpdate(); end |
664 |
How can I add a MAX field
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('max(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
663 |
How can I add a MIN or MAX field (for numbers)
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(11)); AddItem(TObject(21)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('min(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MIN: ''+value'; h := AddItem('max(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
662 |
How can I add a SUM field
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('sum(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''SUM: ''+value'; end; EndUpdate(); end |
661 |
How can I add total and subtotals fields
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesAtRoot; Columns.Add('Members'); with (Columns.Add('Values') as EXGRIDLib.Column) do begin FormatColumn := 'currency(value)'; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.SpinType; Numeric := EXGRIDLib.NumericEnum.exInteger; end; end; with Items do begin h := AddItem('Group 1'); ItemBold[h] := True; CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellValue[TObject(h),TObject(1)] := 'sum(current,dir,dbl(%1))'; CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellHAlignment[TObject(h),TObject(1)] := EXGRIDLib.AlignmentEnum.RightAlignment; CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := TObject(10); CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := TObject(20); CellValue[TObject(InsertItem(h,Nil,'Child 3')),TObject(1)] := TObject(30); ExpandItem[h] := True; h := AddItem('Group 2'); ItemBold[h] := True; CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellValue[TObject(h),TObject(1)] := 'sum(current,dir,dbl(%1))'; CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellHAlignment[TObject(h),TObject(1)] := EXGRIDLib.AlignmentEnum.RightAlignment; CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := TObject(5); CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := TObject(15); CellValue[TObject(InsertItem(h,Nil,'Child 3')),TObject(1)] := TObject(35); h := AddItem('total'); CellValue[TObject(h),TObject(1)] := 'sum(all,rec,dbl(%1))'; CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; FormatCell[TObject(h),TObject(1)] := '''Total: <b>'' + currency(value)'; CellHAlignment[TObject(h),TObject(1)] := EXGRIDLib.AlignmentEnum.RightAlignment; ItemDivider[h] := 1; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; ItemDividerLine[h] := EXGRIDLib.DividerLineEnum.DoubleLine; SortableItem[h] := False; end; EndUpdate(); end |
660 |
Is is possible to have subtotal items, and a grand total item
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin BeginUpdate(); BackColor := Color.FromArgb(255,255,255); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesAtRoot; ShowFocusRect := False; Columns.Add('Members'); with (Columns.Add('Values') as EXGRIDLib.Column) do begin FormatColumn := 'currency(value)'; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.SpinType; Numeric := EXGRIDLib.NumericEnum.exInteger; end; end; with Items do begin h := AddItem('Group 1'); ItemBold[h] := True; SortableItem[h] := False; CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; FormatCell[TObject(h),TObject(1)] := ' '; CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := TObject(10); CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := TObject(20); CellValue[TObject(InsertItem(h,Nil,'Child 3')),TObject(1)] := TObject(30); hT := InsertItem(h,Nil,'subtotal'); CellHAlignment[TObject(hT),TObject(1)] := EXGRIDLib.AlignmentEnum.RightAlignment; CellEditorVisible[TObject(hT),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellValue[TObject(hT),TObject(1)] := 'sum(parent,dir,dbl(%1))'; CellValueFormat[TObject(hT),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); FormatCell[TObject(hT),TObject(1)] := '''subtotal: <b>'' + currency(value)'; ItemDivider[hT] := 1; ItemDividerLineAlignment[hT] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; SortableItem[hT] := False; SelectableItem[hT] := False; ItemDividerLine[hT] := EXGRIDLib.DividerLineEnum.DotLine; ExpandItem[h] := True; h := AddItem('Group 2'); ItemBold[h] := True; SortableItem[h] := False; FormatCell[TObject(h),TObject(1)] := ' '; CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := TObject(15); CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := TObject(25); CellValue[TObject(InsertItem(h,Nil,'Child 3')),TObject(1)] := TObject(18); hT := InsertItem(h,Nil,'subtotal'); CellHAlignment[TObject(hT),TObject(1)] := EXGRIDLib.AlignmentEnum.RightAlignment; CellEditorVisible[TObject(hT),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellValue[TObject(hT),TObject(1)] := 'sum(parent,dir,dbl(%1))'; CellValueFormat[TObject(hT),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); FormatCell[TObject(hT),TObject(1)] := '''subtotal: <b>'' + currency(value)'; ItemDivider[hT] := 1; ItemDividerLineAlignment[hT] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; ItemDividerLine[hT] := EXGRIDLib.DividerLineEnum.DotLine; SortableItem[hT] := False; SelectableItem[hT] := False; ExpandItem[h] := True; h := AddItem('total'); CellValue[TObject(h),TObject(1)] := 'sum(all,rec,dbl(%1))'; CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; FormatCell[TObject(h),TObject(1)] := '''Total: <b><font ;11>'' + currency(value)'; CellHAlignment[TObject(h),TObject(1)] := EXGRIDLib.AlignmentEnum.CenterAlignment; ItemDivider[h] := 1; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; ItemDividerLine[h] := EXGRIDLib.DividerLineEnum.DoubleLine; SortableItem[h] := False; SelectableItem[h] := False; end; EndUpdate(); end |
659 |
Is it possible to have a total field for each column
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin BeginUpdate(); with (Columns.Add('C1') as EXGRIDLib.Column) do begin with Editor do begin Numeric := EXGRIDLib.NumericEnum.exInteger; EditType := EXGRIDLib.EditTypeEnum.SpinType; end; SortType := EXGRIDLib.SortTypeEnum.SortNumeric; end; with (Columns.Add('C2') as EXGRIDLib.Column) do begin with Editor do begin Numeric := EXGRIDLib.NumericEnum.exInteger; EditType := EXGRIDLib.EditTypeEnum.SpinType; end; SortType := EXGRIDLib.SortTypeEnum.SortNumeric; end; with Items do begin LockedItemCount[EXGRIDLib.VAlignmentEnum.exBottom] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exBottom,0]; ItemBackColor[h] := $f0f0f0; ItemBold[h] := True; CellValue[TObject(h),TObject(0)] := 'sum(all,dir,dbl(%0))'; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellValue[TObject(h),TObject(1)] := 'sum(all,dir,dbl(%1))'; CellValueFormat[TObject(h),TObject(1)] := EXGRIDLib.ValueFormatEnum.exTotalField; end; with Items do begin CellValue[TObject(AddItem(TObject(10))),TObject(1)] := TObject(12); CellValue[TObject(AddItem(TObject(25))),TObject(1)] := TObject(5); CellValue[TObject(AddItem(TObject(31))),TObject(1)] := TObject(17); CellValue[TObject(AddItem(TObject(48))),TObject(1)] := TObject(22); end; EndUpdate(); end |
658 |
How can I add a total field for a DataSource being used
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin ColumnAutoResize := False; ContinueColumnScroll := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); with Items do begin LockedItemCount[EXGRIDLib.VAlignmentEnum.exTop] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exTop,0]; ItemDivider[h] := 0; CellValueFormat[TObject(h),TObject(0)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellValue[TObject(h),TObject(0)] := 'sum(all,dir,%1)'; end; end |
657 |
How can I add a total field
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Numbers') as EXGRIDLib.Column) do begin with Editor do begin Numeric := EXGRIDLib.NumericEnum.exInteger; EditType := EXGRIDLib.EditTypeEnum.SpinType; end; SortType := EXGRIDLib.SortTypeEnum.SortNumeric; end; with Items do begin LockedItemCount[EXGRIDLib.VAlignmentEnum.exTop] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exTop,0]; ItemBackColor[h] := $f0f0f0; CellValue[TObject(h),TObject(0)] := 'sum(all,dir,dbl(%0))'; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''Total: ''+value'; end; with Items do begin AddItem(TObject(10)); AddItem(TObject(25)); AddItem(TObject(31)); AddItem(TObject(48)); end; EndUpdate(); end |
656 |
How can I add a total field
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Items') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.SpinType; Numeric := EXGRIDLib.NumericEnum.exInteger; end; with Items do begin h := AddItem('Group 1'); CellEditorVisible[TObject(h),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; InsertItem(h,Nil,TObject(10)); InsertItem(h,Nil,TObject(20)); InsertItem(h,Nil,TObject(30)); hT := InsertItem(h,Nil,'sum(parent,dir,dbl(%0))'); CellEditorVisible[TObject(hT),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellValueFormat[TObject(hT),TObject(0)] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); ItemDivider[hT] := 0; ItemDividerLineAlignment[hT] := EXGRIDLib.DividerAlignmentEnum.DividerTop; SelectableItem[hT] := False; SortableItem[hT] := False; ExpandItem[h] := True; end; EndUpdate(); end |
655 |
Is it possible to specify the cell's value but still want to display some formatted text instead the value
with AxGrid1 do begin BeginUpdate(); Columns.Add('Value'); Columns.Add('FormatCell'); with Items do begin h := AddItem(TObject(1)); CellValue[TObject(h),TObject(1)] := TObject(12); FormatCell[TObject(h),TObject(1)] := 'currency(value)'; h := AddItem('1/1/2001'); CellValue[TObject(h),TObject(1)] := '1/1/2001'; CellValueFormat[TObject(h),TObject(1)] := EXGRIDLib.ValueFormatEnum.exHTML; FormatCell[TObject(h),TObject(1)] := 'longdate(value) replace ''2001'' with ''<b>2001</b>'''; end; EndUpdate(); end |
654 |
How can I simulate displaying groups
with AxGrid1 do begin HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine; ScrollBySingleLine := True; with Columns do begin Add('Name'); Add('A'); Add('B'); Add('C'); end; with Items do begin h := AddItem('Group 1'); CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerBoth; ItemHeight[h] := 24; SortableItem[h] := False; h1 := InsertItem(h,Nil,'Child 1'); CellValue[TObject(h1),TObject(1)] := TObject(1); CellValue[TObject(h1),TObject(2)] := TObject(2); CellValue[TObject(h1),TObject(3)] := TObject(3); h1 := InsertItem(h,Nil,'Child 2'); CellValue[TObject(h1),TObject(1)] := TObject(4); CellValue[TObject(h1),TObject(2)] := TObject(5); CellValue[TObject(h1),TObject(3)] := TObject(6); ExpandItem[h] := True; h := AddItem('Group 2'); CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerBoth; ItemHeight[h] := 24; SortableItem[h] := False; h1 := InsertItem(h,Nil,'Child 1'); CellValue[TObject(h1),TObject(1)] := TObject(1); CellValue[TObject(h1),TObject(2)] := TObject(2); CellValue[TObject(h1),TObject(3)] := TObject(3); h1 := InsertItem(h,Nil,'Child 2'); CellValue[TObject(h1),TObject(1)] := TObject(4); CellValue[TObject(h1),TObject(2)] := TObject(5); CellValue[TObject(h1),TObject(3)] := TObject(6); ExpandItem[h] := True; end; end |
653 |
Is it possible to specify the cell's value but still want to display some formatted text instead the value
with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (Add('Values') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 64; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; end; with Items do begin h := AddItem('Root'); FormatCell[TObject(h),TObject(1)] := '''<none>'''; CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := TObject(10); CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := TObject(15); CellValue[TObject(InsertItem(h,Nil,'Child 3')),TObject(1)] := TObject(25); ExpandItem[h] := True; end; EndUpdate(); end |
652 |
I am using the FormatColumn to display the current currency, but would like hide some values. Is it possible
with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (Add('Values') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 64; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; end; with Items do begin h := AddItem('Root'); FormatCell[TObject(h),TObject(1)] := ' '; CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := TObject(10); CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := TObject(15); CellValue[TObject(InsertItem(h,Nil,'Child 3')),TObject(1)] := TObject(25); ExpandItem[h] := True; end; EndUpdate(); end |
651 |
How can I specify an item to be always the first item
with AxGrid1 do begin BeginUpdate(); TreeColumnIndex := -1; (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('first'); ItemPosition[h] := 0; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; SortableItem[h] := False; SortChildren(0,TObject(0),False); end; EndUpdate(); end |
650 |
How can I specify an item to be always the last item
with AxGrid1 do begin BeginUpdate(); TreeColumnIndex := -1; (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('last'); CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; SortableItem[h] := False; SortChildren(0,TObject(0),True); end; EndUpdate(); end |
649 |
Can I allow sorting only the child items
with AxGrid1 do begin BeginUpdate(); Columns.Add('Childs'); with Items do begin h := AddItem('Root 1'); SortableItem[h] := False; InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); SortableItem[h] := False; InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; end; EndUpdate(); end |
648 |
Can I specify a terminal item so it will mark the end of childs
with AxGrid1 do begin BeginUpdate(); ScrollBySingleLine := True; Columns.Add('P1'); with Items do begin h := AddItem('Root 1'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := InsertItem(h,'',''); ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; ItemHeight[h] := 2; SelectableItem[h] := False; SortableItem[h] := False; h := AddItem('Root 2'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := InsertItem(h,'',''); ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerCenter; ItemHeight[h] := 2; SelectableItem[h] := False; SortableItem[h] := False; end; EndUpdate(); end |
647 |
Is it possible to specify an item being unsortable so its position won't be changed after sorting
with AxGrid1 do begin BeginUpdate(); TreeColumnIndex := -1; (Columns.Add('Numbers') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortNumeric; with Items do begin AddItem(TObject(1)); AddItem(TObject(2)); AddItem(TObject(3)); AddItem(TObject(4)); h := AddItem('top 3'); ItemPosition[h] := 3; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; SortableItem[h] := False; SortChildren(0,TObject(0),False); end; EndUpdate(); end |
646 |
Is it possible to move an item from a parent to another
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin AddItem('A'); AddItem('B'); InsertItem(AddItem('C'),'','D'); SetParent(FindItem['D',TObject(0),Nil],FindItem['A',TObject(0),Nil]); end; EndUpdate(); end |
645 |
How can I change the identation for an item
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin AddItem('A'); AddItem('B'); InsertItem(AddItem('C'),'','D'); SetParent(FindItem['D',TObject(0),Nil],0); end; EndUpdate(); end |
644 |
How can I arrange the control's header on multiple levels
with AxGrid1 do begin BeginUpdate(); DefaultItemHeight := 48; with Columns do begin (Add('Title') as EXGRIDLib.Column).Visible := False; (Add('FirstName') as EXGRIDLib.Column).Visible := False; (Add('LastName') as EXGRIDLib.Column).Visible := False; (Add('Photo') as EXGRIDLib.Column).Visible := False; with (Add('Address') as EXGRIDLib.Column) do begin Visible := False; Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False); end; with (Add('Personal Info') as EXGRIDLib.Column) do begin FormatLevel := '3:48,(0/1/2),4:96'; Def[EXGRIDLib.DefColumnEnum.exCellFormatLevel] := '3:48,(0/1/2),4:96'; end; end; with Items do begin h := AddItem('Sales Representative'); CellValue[TObject(h),TObject(1)] := 'Nancy'; CellValue[TObject(h),TObject(2)] := 'Davolio'; CellPicture[TObject(h),TObject(3)] := AxGrid1.ExecuteTemplate('loadpicture(`c:\exontrol\images\zipdisk.gif`)'); CellValue[TObject(h),TObject(4)] := '507-20th Ave. E.Apt. 2A'; end; EndUpdate(); end |
643 |
How can I filter programatically using more columns
with AxGrid1 do begin BeginUpdate(); with Columns do begin Add('Car'); Add('Equipment'); end; with Items do begin CellValue[TObject(AddItem('Mazda')),TObject(1)] := 'Air Bag'; CellValue[TObject(AddItem('Toyota')),TObject(1)] := 'Air Bag,Air condition'; CellValue[TObject(AddItem('Ford')),TObject(1)] := 'Air condition'; CellValue[TObject(AddItem('Nissan')),TObject(1)] := 'Air Bag,ABS,ESP'; CellValue[TObject(AddItem('Mazda')),TObject(1)] := 'Air Bag, ABS,ESP'; CellValue[TObject(AddItem('Mazda')),TObject(1)] := 'ABS,ESP'; end; with Columns.Item['Car'] do begin FilterType := EXGRIDLib.FilterTypeEnum.exFilter; Filter := 'Mazda'; end; with Columns.Item['Equipment'] do begin FilterType := EXGRIDLib.FilterTypeEnum.exPattern; Filter := '*ABS*|*ESP*'; end; ApplyFilter(); EndUpdate(); end |
642 |
How can I show the ticks for a single slider field
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Slider') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.SliderType; with Items do begin AddItem(TObject(10)); with CellEditor[TObject(AddItem(TObject(20))),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.SliderType; Option[EXGRIDLib.EditorOptionEnum.exSliderTickFrequency] := TObject(10); end; AddItem(TObject(30)); end; EndUpdate(); end |
641 |
Is it possible to show ticks for slider fields
with AxGrid1 do begin with (Columns.Add('Slider') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.SliderType; Option[EXGRIDLib.EditorOptionEnum.exSliderTickFrequency] := TObject(10); end; Items.AddItem(TObject(10)); end |
640 |
Is it possible to colour a particular column, I mean the cell's foreground color
with AxGrid1 do begin BeginUpdate(); with ConditionalFormats.Add('1',Nil) do begin ForeColor := $ff; ApplyTo := EXGRIDLib.FormatApplyToEnum($1); end; MarkSearchColumn := False; with Columns do begin Add('Column 1'); Add('Column 2'); end; with Items do begin CellValue[TObject(AddItem(TObject(0))),TObject(1)] := TObject(1); CellValue[TObject(AddItem(TObject(2))),TObject(1)] := TObject(3); CellValue[TObject(AddItem(TObject(4))),TObject(1)] := TObject(5); end; EndUpdate(); end |
639 |
Is it possible to colour a particular column for specified values
with AxGrid1 do begin BeginUpdate(); with ConditionalFormats.Add('int(%1) in (3,4,5)',Nil) do begin BackColor := $ff; ApplyTo := EXGRIDLib.FormatApplyToEnum($1); end; MarkSearchColumn := False; with Columns do begin Add('Column 1'); Add('Column 2'); end; with Items do begin CellValue[TObject(AddItem(TObject(0))),TObject(1)] := TObject(1); CellValue[TObject(AddItem(TObject(2))),TObject(1)] := TObject(3); CellValue[TObject(AddItem(TObject(4))),TObject(1)] := TObject(5); end; EndUpdate(); end |
638 |
Is it possible to colour a particular column
with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellBackColor] := TObject(255); end; with Items do begin CellValue[TObject(AddItem(TObject(0))),TObject(1)] := TObject(1); CellValue[TObject(AddItem(TObject(2))),TObject(1)] := TObject(3); CellValue[TObject(AddItem(TObject(4))),TObject(1)] := TObject(5); end; EndUpdate(); end |
637 |
How do i get all the children items that are under a certain parent Item handle
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('P'); with Items do begin h := AddItem('Root'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; end; with Items do begin hChild := ItemChild[FirstVisibleItem]; OutputDebugString( CellValue[TObject(hChild),TObject(0)] ); OutputDebugString( CellValue[TObject(NextSiblingItem[hChild]),TObject(0)] ); end; EndUpdate(); end |
636 |
Is is possible to use HTML tags to display in the filter caption
with AxGrid1 do begin BeginUpdate(); FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarCaption := 'This is a bit of text being displayed in the filter bar.'; Columns.Add(''); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; EndUpdate(); end |
635 |
How can I find the number of items after filtering
with AxGrid1 do begin BeginUpdate(); Columns.Add(''); with Items do begin h := AddItem(''); CellValue[TObject(h),TObject(0)] := TObject(VisibleItemCount); end; EndUpdate(); end |
634 |
How can I change the filter caption
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptWords) Or Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAll); FilterBarPromptPattern := 'london robert'; FilterBarCaption := '<r>Found: ... '; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
633 |
While using the filter prompt is it is possible to use wild characters
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptPattern; FilterBarPromptPattern := 'lon* seat*'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
632 |
How can I list all items that contains any of specified words, not necessary at the beggining
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptStartWords) Or Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAny); FilterBarPromptPattern := 'london davolio'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
631 |
How can I list all items that contains any of specified words, not strings
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptWords) Or Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAny); FilterBarPromptPattern := 'london nancy'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
630 |
How can I list all items that contains all specified words, not strings
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptWords) Or Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAll); FilterBarPromptPattern := 'london robert'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
629 |
I've noticed that the filtering by prompt is not case sensitive, is is possible to make it case sensitive
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptCaseSensitive) Or Integer(EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAny); FilterBarPromptPattern := 'Anne'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
628 |
Is it possible to list only items that ends with any of specified strings
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptEndWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'Fuller'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
627 |
Is it possible to list only items that ends with any of specified strings
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptEndWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'Fuller'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
626 |
Is it possible to list only items that starts with any of specified strings
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptStartWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'An M'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
625 |
Is it possible to list only items that starts with specified string
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptStartWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'A'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
624 |
How can I specify that the list should include any of the seqeunces in the pattern
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAny; FilterBarPromptPattern := 'london seattle'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
623 |
How can I specify that all sequences in the filter pattern must be included in the list
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib.FilterPromptEnum.exFilterPromptContainsAll; FilterBarPromptPattern := 'london manager'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
622 |
How do I change at runtime the filter prompt
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptPattern := 'london manager'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
621 |
How do I specify to filter only a single column when using the filter prompt
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPromptColumns := '2,3'; FilterBarPromptPattern := 'london'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
620 |
How do I change the prompt or the caption being displayed in the filter bar
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; FilterBarPrompt := 'changed'; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; EndUpdate(); end |
619 |
How do I enable the filter prompt feature
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible; with Columns do begin (Add('Name') as EXGRIDLib.Column).Width := 96; (Add('Title') as EXGRIDLib.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales'; CellValue[TObject(h0),TObject(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[TObject(h0),TObject(1)] := 'Sales Manager'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator'; CellValue[TObject(h0),TObject(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[TObject(h0),TObject(1)] := 'Sales Representative'; CellValue[TObject(h0),TObject(2)] := 'London'; end; EndUpdate(); end |
618 |
How can I control the colors that can be applied to an EBN part
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin with Items do begin ItemBackColor[FirstVisibleItem] := e.newValue; end; end end; with AxGrid1 do begin BeginUpdate(); with VisualAppearance do begin Add(2,'c:\exontrol\images\normal.ebn'); Add(1,'CP:2 10 3 -10 -5'); end; SelBackColor := BackColor; SelForeColor := ForeColor; ScrollBySingleLine := True; TreeColumnIndex := -1; with Columns do begin with (Add('Test') as EXGRIDLib.Column) do begin Width := 32; end; with (Add('RGB') as EXGRIDLib.Column) do begin with Editor do begin EditType := EXGRIDLib.EditTypeEnum.SliderType; Option[EXGRIDLib.EditorOptionEnum.exSliderMax] := TObject(255); Option[EXGRIDLib.EditorOptionEnum.exSliderWidth] := TObject(-60); end; end; end; with Items do begin h := AddItem(''); CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment; ItemDivider[h] := 0; ItemBackColor[h] := $1000000; ItemHeight[h] := 36; SelectableItem[h] := False; h := InsertItem(0,TObject(1),'Red'); CellValue[TObject(h),TObject(1)] := TObject(255); h := InsertItem(0,TObject(255),'Green'); CellValue[TObject(h),TObject(1)] := TObject(255); h := InsertItem(0,TObject(65536),'Blue'); CellValue[TObject(h),TObject(1)] := TObject(255); end; EndUpdate(); end |
617 |
I know this is fairly basic, but could you send me a sample that places a tree in the first column
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('heading'); with Items do begin h := AddItem('Parent 1'); InsertItem(h,Nil,'Child A'); InsertItem(InsertItem(h,Nil,'Child B'),Nil,'GrandChild C'); ExpandItem[h] := True; h := AddItem('Parent 2'); InsertItem(h,Nil,'Child D'); InsertItem(h,Nil,'Child E'); ExpandItem[h] := True; end; EndUpdate(); end |
616 |
How can I get the caption of focused item
// SelectionChanged event - Fired after a new item has been selected. procedure TWinForm1.AxGrid1_SelectionChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin OutputDebugString( 'Handle' ); OutputDebugString( FocusItem ); OutputDebugString( 'Caption' ); OutputDebugString( CellCaption[TObject(FocusItem),TObject(0)] ); end; end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'Cell 1.1'); InsertItem(h,Nil,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'Cell 2.1'); InsertItem(h,Nil,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
615 |
How can I get the caption of selected item
// SelectionChanged event - Fired after a new item has been selected. procedure TWinForm1.AxGrid1_SelectionChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin OutputDebugString( 'Handle' ); OutputDebugString( SelectedItem[0] ); OutputDebugString( 'Caption' ); OutputDebugString( CellCaption[TObject(SelectedItem[0]),TObject(0)] ); end; end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'Cell 1.1'); InsertItem(h,Nil,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'Cell 2.1'); InsertItem(h,Nil,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
614 |
Is it possible to let users selects cells as in Excel
with AxGrid1 do begin BeginUpdate(); FullRowSelect := EXGRIDLib.CellSelectEnum.exRectSel; SingleSel := False; ReadOnly := EXGRIDLib.ReadOnlyEnum.exReadOnly; MarkSearchColumn := False; ShowFocusRect := False; LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; SelForeColor := Color.FromArgb(0,0,0); SelBackColor := Color.FromArgb(200,225,242); with Columns do begin Add('A'); with (Add('B') as EXGRIDLib.Column) do begin AllowSizing := False; Width := 24; end; with (Add('C') as EXGRIDLib.Column) do begin AllowSizing := False; Width := 24; Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(1); PartialCheck := True; end; with (Add('D') as EXGRIDLib.Column) do begin AllowSizing := False; Width := 24; Def[EXGRIDLib.DefColumnEnum.exCellHasRadioButton] := TObject(1); end; end; with Items do begin h := InsertItem(Nil,Nil,'Group 1'); h1 := InsertItem(h,Nil,TObject(16)); CellValue[TObject(h1),TObject(1)] := TObject(17); h1 := InsertItem(h,Nil,TObject(2)); CellValue[TObject(h1),TObject(1)] := TObject(11); h1 := InsertItem(h,Nil,TObject(2)); ItemBackColor[h1] := $f0f0f0; CellValue[TObject(h1),TObject(1)] := TObject(9); ExpandItem[h] := True; h := InsertItem(Nil,Nil,'Group 2'); CellValueFormat[TObject(h),TObject(2)] := EXGRIDLib.ValueFormatEnum.exHTML; h1 := InsertItem(h,Nil,TObject(16)); CellValue[TObject(h1),TObject(1)] := TObject(9); h1 := InsertItem(h,Nil,TObject(12)); CellValue[TObject(h1),TObject(1)] := TObject(11); h1 := InsertItem(h,Nil,TObject(2)); CellValue[TObject(h1),TObject(1)] := TObject(2); ExpandItem[h] := True; SelectItem[h] := True; end; EndUpdate(); end |
613 |
Is it possible to change the style for the vertical or horizontal grid lines, in the list area
with AxGrid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; GridLineStyle := Integer(EXGRIDLib.GridLinesStyleEnum.exGridLinesVSolid) Or Integer(EXGRIDLib.GridLinesStyleEnum.exGridLinesHDot4); Columns.Add('C1'); Columns.Add('C2'); Columns.Add('C3'); with Items do begin h := AddItem('Item 1'); CellValue[TObject(h),TObject(1)] := 'SubItem 1.2'; CellValue[TObject(h),TObject(2)] := 'SubItem 1.3'; h := AddItem('Item 2'); CellValue[TObject(h),TObject(1)] := 'SubItem 2.2'; CellValue[TObject(h),TObject(2)] := 'SubItem 2.3'; end; EndUpdate(); end |
612 |
Is it possible to change the style for the grid lines, for instance to be solid not dotted
|
611 |
I have some buttons added on the control's scroll bar, how can I can know when the button is being clicked
// ScrollButtonClick event - Occurs when the user clicks a button in the scrollbar. procedure TWinForm1.AxGrid1_ScrollButtonClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ScrollButtonClickEvent); begin with AxGrid1 do begin OutputDebugString( e.scrollBar ); OutputDebugString( e.scrollPart ); end end; with AxGrid1 do begin set_ScrollPartVisible(EXGRIDLib.ScrollBarEnum.exHScroll,EXGRIDLib.ScrollPartEnum.exLeftB1Part,True); set_ScrollPartVisible(EXGRIDLib.ScrollBarEnum.exHScroll,EXGRIDLib.ScrollPartEnum.exLeftB2Part,True); set_ScrollPartVisible(EXGRIDLib.ScrollBarEnum.exHScroll,EXGRIDLib.ScrollPartEnum.exRightB6Part,True); set_ScrollPartVisible(EXGRIDLib.ScrollBarEnum.exHScroll,EXGRIDLib.ScrollPartEnum.exRightB5Part,True); ScrollBars := EXGRIDLib.ScrollBarsEnum.exDisableNoHorizontal; end |
610 |
How do I get notified once the user clicks a hyperlink created using the anchor HTML tag
// AnchorClick event - Occurs when an anchor element is clicked. procedure TWinForm1.AxGrid1_AnchorClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AnchorClickEvent); begin with AxGrid1 do begin OutputDebugString( e.anchorID ); OutputDebugString( e.options ); end end; with AxGrid1 do begin (Columns.Add('Default') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin AddItem('This is a link: <aex.com;1>www.exontrol.com</a>'); AddItem('This is a link: <aex.net;2>www.exontrol.net</a>'); end; end |
609 |
Is it possible to start editing a cell when double click it
// DblClick event - Occurs when the user dblclk the left mouse button over an object. procedure TWinForm1.AxGrid1_DblClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_DblClickEvent); begin with AxGrid1 do begin Edit(Nil); end end; with AxGrid1 do begin BeginUpdate(); AutoEdit := False; MarkSearchColumn := False; (Columns.Add('Edit1') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; (Columns.Add('Edit2') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem(TObject(1))),TObject(1)] := TObject(2); end; with Items do begin CellValue[TObject(AddItem(TObject(3))),TObject(1)] := TObject(4); end; EndUpdate(); end |
608 |
Is it possible to disable standard single-click behavior for this column, so I manually could call Edit() when needed
// DblClick event - Occurs when the user dblclk the left mouse button over an object. procedure TWinForm1.AxGrid1_DblClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_DblClickEvent); begin with AxGrid1 do begin Edit(Nil); end end; with AxGrid1 do begin BeginUpdate(); AutoEdit := False; MarkSearchColumn := False; (Columns.Add('Edit1') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; (Columns.Add('Edit2') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem(TObject(1))),TObject(1)] := TObject(2); end; with Items do begin CellValue[TObject(AddItem(TObject(3))),TObject(1)] := TObject(4); end; EndUpdate(); end |
607 |
How can I get or restore the old or previously value for the cell being changed
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin OutputDebugString( 'Old-Value:' ); OutputDebugString( Items.CellValue[TObject(e.item),TObject(e.colIndex)] ); OutputDebugString( 'New-Value:' ); OutputDebugString( e.newValue ); end end; with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; (Columns.Add('Edit1') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; (Columns.Add('Edit2') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem(TObject(1))),TObject(1)] := TObject(2); end; with Items do begin CellValue[TObject(AddItem(TObject(3))),TObject(1)] := TObject(4); end; EndUpdate(); end |
606 |
How can I get the item from the cursor
// MouseMove event - Occurs when the user moves the mouse. procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent); begin with AxGrid1 do begin h := get_ItemFromPoint(-1,-1,c,hit); OutputDebugString( 'Handle' ); OutputDebugString( h ); OutputDebugString( 'Index' ); OutputDebugString( Items.ItemToIndex[h] ); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; DrawGridLines := EXGRIDLib.GridLinesEnum.exHLines; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'Cell 1.1'); InsertItem(h,Nil,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'Cell 2.1'); InsertItem(h,Nil,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
605 |
How can I get the column from the cursor, not only in the header
// MouseMove event - Occurs when the user moves the mouse. procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent); begin with AxGrid1 do begin OutputDebugString( get_ColumnFromPoint(-1,0) ); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('P1'); Columns.Add('P2'); DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; with Items do begin h := AddItem('R1'); CellValue[TObject(h),TObject(1)] := 'R2'; CellValue[TObject(InsertItem(h,Nil,'Cell 1.1')),TObject(1)] := 'Cell 1.2'; CellValue[TObject(InsertItem(h,Nil,'Cell 2.1')),TObject(1)] := 'Cell 2.2'; ExpandItem[h] := True; end; EndUpdate(); end |
604 |
How can I get the column from the cursor
// MouseMove event - Occurs when the user moves the mouse. procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent); begin with AxGrid1 do begin OutputDebugString( get_ColumnFromPoint(-1,-1) ); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; Columns.Add('P1'); Columns.Add('P2'); with Items do begin h := AddItem('R1'); CellValue[TObject(h),TObject(1)] := 'R2'; CellValue[TObject(InsertItem(h,Nil,'Cell 1.1')),TObject(1)] := 'Cell 1.2'; CellValue[TObject(InsertItem(h,Nil,'Cell 2.1')),TObject(1)] := 'Cell 2.2'; ExpandItem[h] := True; end; EndUpdate(); end |
603 |
How can I get the cell's caption from the cursor
// MouseMove event - Occurs when the user moves the mouse. procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent); begin with AxGrid1 do begin h := get_ItemFromPoint(-1,-1,c,hit); OutputDebugString( Items.CellCaption[TObject(h),TObject(c)] ); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'Cell 1.1'); InsertItem(h,Nil,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'Cell 2.1'); InsertItem(h,Nil,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
602 |
How can I customize the items based on the values in the cells
with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; with ConditionalFormats do begin with Add('%1 >4',Nil) do begin Bold := True; StrikeOut := True; ForeColor := $ff; ApplyTo := EXGRIDLib.FormatApplyToEnum.exFormatToItems; end; with Add('%2 > 4',Nil) do begin Bold := True; StrikeOut := True; ForeColor := $ff; ApplyTo := EXGRIDLib.FormatApplyToEnum($2); end; with Add('%3 > 4',Nil) do begin Bold := True; StrikeOut := True; ForeColor := $ff; ApplyTo := EXGRIDLib.FormatApplyToEnum($3); end; end; with Columns do begin Add('Name'); with (Add('A') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('B') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('C') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' ='''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('A+B+C') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 64; ComputedField := '%1+%2+%3'; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; end; with Items do begin h := AddItem('Root'); CellValueFormat[TObject(h),TObject(4)] := EXGRIDLib.ValueFormatEnum.exComputedField; h1 := InsertItem(h,Nil,'Child 1'); CellValue[TObject(h1),TObject(1)] := TObject(7); CellValue[TObject(h1),TObject(2)] := TObject(3); CellValue[TObject(h1),TObject(3)] := TObject(1); h1 := InsertItem(h,Nil,'Child 2'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(5); CellValue[TObject(h1),TObject(3)] := TObject(12); h1 := InsertItem(h,Nil,'Child 3'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(2); CellValue[TObject(h1),TObject(3)] := TObject(4); h1 := InsertItem(h,Nil,'Child 4'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(9); CellValue[TObject(h1),TObject(3)] := TObject(4); ExpandItem[h] := True; end; EndUpdate(); end |
601 |
Is it is possible to have a column computing values from other columns
with AxGrid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (Add('A') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('B') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('C') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' ='''; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with (Add('A+B+C') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortNumeric; AllowSizing := False; Width := 64; ComputedField := '%1+%2+%3'; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; end; with Items do begin h := AddItem('Root'); CellValueFormat[TObject(h),TObject(4)] := EXGRIDLib.ValueFormatEnum.exComputedField; h1 := InsertItem(h,Nil,'Child 1'); CellValue[TObject(h1),TObject(1)] := TObject(7); CellValue[TObject(h1),TObject(2)] := TObject(3); CellValue[TObject(h1),TObject(3)] := TObject(1); h1 := InsertItem(h,Nil,'Child 2'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(5); CellValue[TObject(h1),TObject(3)] := TObject(12); h1 := InsertItem(h,Nil,'Child 3'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(2); CellValue[TObject(h1),TObject(3)] := TObject(4); h1 := InsertItem(h,Nil,'Child 4'); CellValue[TObject(h1),TObject(1)] := TObject(2); CellValue[TObject(h1),TObject(2)] := TObject(9); CellValue[TObject(h1),TObject(3)] := TObject(4); ExpandItem[h] := True; end; EndUpdate(); end |